#ifndef __JOB_H__
#define __JOB_H__ 

#include <sys/types.h>

#define RUN     "Running"
#define STOP    "Stopped"

#define SET_NO      0
#define SET_FG      1
#define SET_BG      2

typedef struct _job_info {
    int                 jid;        /* job id */
    pid_t               pgid;       /* job process group id */
    int                 alive;      /* alive process count */
    int                 run;        /* running process count */
    char                *status;    /* status */
    char                *cmdline;   /* cmdline */
    struct _job_info    *next;      /* pointer to next job */
} job_info;

void init_jobs();
void free_jobs();
void print_jobs();
void add_job(pid_t pgid, int alive, int run, char *status, char *cmdline);
void del_job(pid_t pgid);
job_info *set_job(pid_t pgid, char *status, int cmd_set);
job_info *find_job(int jid, pid_t pgid);

#endif
